<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
include("db/connect.php");
$selectprovince="SELECT * FROM province ORDER BY province_name ASC";
$queryprovince=mysql_query($selectprovince);

?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script>
$(document).ready(function() {
    $("#province_id").change(function(){
		if($("#province_id").val()==1234){
			alert("โปรดเลือกจังหวัด");
			$("#amphur_id").html('');
			$("#amphur_id").html("<option value='1234'>โปรดเลือกจังหวัด</option>");
			$("#tambol_id").html('');
			$("#tambol_id").html("<option value='1234'>โปรดเลือกอำเภอ</option>");
			}
			else{
		$.ajax({
			type:"POST",
			url:"listamphur.php",
			data:"temp="+$("#province_id").val(),
			success: function(msg){
				$("#spaceamphur").html(msg);
				}
			});//ajax
			}//else
	});//province change
}); 
/*function amphur*/
function amphur_change(){
		$.ajax({
			type:"POST",
			url:"listtambon.php",
			data:"temp="+$("#amphur_id").val(),
			success: function(msg){
				$("#spacetambol").html(msg);
				}
			});//ajax
	}//amphurchange
	
</script>
<script language="javascript">
</script>
<style type="text/css">
#fromInsert_emp p {
	text-align: center;
	font-size: 36px;
}
</style>
</head>
<body>
<form id="fromInsert_emp" name="fromInsert_emp" method="post" action="Javascript:submitEmp();">
  <p>ข้อมูลพนักงาน</p>
  <table width="528" border="0">
    <tr>
      <td width="178">คำนำหน้าชื่อ</td>
      <td width="340">
       
          <label for="select"></label>
          <select name="emp_title" id="emp_title"> 
            <option>โปรดเลือกคำนำหน้าชื่อ</option>
            <option value="0">นาย</option>
            <option value="1">นาง</option>
            <option value="2">นางสาว</option>
          </select>
      
      </td>
    </tr>
    <tr>
      <td>ชื่อ</td>
      <td><input name="emp_name" type="text" required="required" id="emp_name" /></td>
    </tr>
    <tr>
      <td>นามสกุล</td>
      <td><input name="emp_lastname" type="text" required="required" id="emp_lastname" /></td>
    </tr>
    <tr>
      <td>ที่อยู่</td>
      <td><textarea name="emp_addr" id="emp_addr" cols="45" rows="3" required="required"></textarea></td>
    </tr>
    <tr>
      <td>จังหวัด :</td>
      <td>
        <select name="province_id" id="province_id">
          <option value="1234">โปรดเลือก</option>
          <?php 
	while($resultprovince=mysql_fetch_array($queryprovince)){
		?>
          <option value="<?php echo$resultprovince["province_id"]?>"><?php echo $resultprovince["province_name"]?></option>

          <?php
        }
	?>
        </select>
      </td>
    </tr>
    <tr>
      <td>อำเภอ :</td>
      <td>
      <div id="spaceamphur">
    
        <select name="amphur_id" id="amphur_id">
          <option>โปรดเลือกจังหวัด</option>
        </select>
      </div></td>
    </tr>
    <tr>
      <td>ตำบล :</td>
      <td>  <div id="spacetambol"><select name="tambol_id" id="tambol_id">
        <option>โปรดเลือกอำเภอ</option>
      </select></div></td>
    </tr>
    <tr>
      <td>รหัสไปรษณีย์</td>
      <td><input name="emp_postal" type="text" required="required" id="emp_postal" maxlength="5" /></td>
    </tr>
    <tr>
      <td>เบอร์โทรศัพท์</td>
      <td><input type="text" name="emp_tel" id="emp_tel" required="required"/></td>
    </tr>
    <tr>
      <td>E-mail</td>
      <td><input type="email" name="emp_mail" id="emp_mail" required="required"/></td>
    </tr>
    <tr>
      <td>Username</td>
      <td><input type="text" name="emp_user" id="emp_user" required="required"/></td>
    </tr>
    <tr>
      <td>Password</td>
      <td><input name="emp_pass" type="password" required="required" id="emp_pass" maxlength="16"/></td>
    </tr>
  </table>
  <p>
    <input type="submit" name="Submit" id="button" value="ตกลง" />
    <input type="reset" name="button2" id="button2" value="ยกเลิก" />
  </p>
</form>
<div id="spantest"></div>
่
</body>
</html>
